package com.newzqxq.koalamoney.common;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.newzqxq.koalamoney.R;
import com.newzqxq.koalamoney.utils.StatusBarUtil;

import butterknife.ButterKnife;

/**
 * Created by ZQXQ-Developer on 2017/7/15.
 */

public abstract class BaseFragment extends Fragment {
    protected Activity mContext;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = initView(inflater, container);
        ButterKnife.bind(this, view);
        initData();
        return view;
    }


    /**
     * 加载布局
     */
    protected abstract View initView(LayoutInflater inflater, ViewGroup container);

    /**
     * 处理数据
     */
    protected abstract void initData();

    /**
     * 界面跳转
     *
     * @param tarActivity
     */
    protected void intent2Activity(Class<? extends Activity> tarActivity) {
        Intent intent = new Intent(mContext, tarActivity);
        startActivity(intent);
    }


}
